#include "MainWindow.h"
 

MainWindow::MainWindow() : QWidget()
{
	QHBoxLayout *layout_h = new QHBoxLayout;
	QVBoxLayout *layout_v = new QVBoxLayout;

	Widgets *widgets = new Widgets;
	Connexion *connexion = new Connexion;
	Telemetry *telemetry = new Telemetry;
	Video *video = new Video;
	Control *control = new Control;

	//bouton1 = new QPushButton("Salut");

	//setFixedSize(500, 500);
	layout_v->addWidget(widgets);
	layout_v->addWidget(connexion);
	layout_v->addWidget(video);
	layout_v->addLayout(layout_h);

	
	layout_h->addWidget(telemetry);
	layout_h->addWidget(control);

	setLayout(layout_v); 

	Network *n =  new Network(telemetry, video);
	n->start();

	QObject::connect(n, SIGNAL(set_img(unsigned char*, int, int)), video, SLOT(setImg(unsigned char*, int, int)) );
	QObject::connect(widgets, SIGNAL(record_video()), n, SLOT(record_video()) );
	QObject::connect(widgets, SIGNAL(stop_record()), n, SLOT(stop_record()) );


}




